.tuleap-modal-background {
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    opacity: 0.5;
    filter: alpha(opacity=50);
}

.tuleap-modal-loading {
    $loading-size: 110px;

    position: fixed;
    z-index: 2000;
    top: 50%;
    left: 50%;
    width: $loading-size;
    height: $loading-size;
    margin-top: -($loading-size / 2);
    margin-left: -($loading-size / 2);
    background: #303030 url('../images/tuleap-modal-spinner.gif') no-repeat center center;
    border-radius: 50%;
}

.tuleap-modal {
    $modal-radius: 5px;
    $modal-padding: 15px;
    $modal-border: 1px solid #666;
    $modal-height: 400px;
    $modal-width: 430px;
    $grip-width: 30px;
    $grip-background-color: #303030;
    $grip-color: #DDDDDD;
    $side-content-width: 250px;
    $title-background-color: #FFFFFF;
    $title-color: #222222;
    $content-background-color: #FFFFFF;
    $side-content-background-color: #F8F8F8;
    $side-content-background-color: #FFFFFF;
    $action-background-color: #F5F5F5;
    $side-action-background-color: #F5F5F5;

    font-family: 'SourceSansPro', 'Helvetica Neue', Arial, sans-serif;
    font-style: normal;
    display: none;
    position: fixed;
    z-index: 2001;
    top: 150px;
    left: 50%;
    margin: 0 0 0 #{-($modal-width + 2 * $grip-width) / 2};
    padding: 0;
    height: $modal-height;
    box-shadow: 0 2px 40px rgba(0, 0, 0, 0.3);

    .tuleap-modal-side-panel {
        float: left;
        height: $modal-height;
        *height: $modal-height + 6 * $modal-padding;
        *width: $grip-width;

        .tuleap-modal-side-panel-content {
            display: none;
            *display: block;
            float: left;
            width: $side-content-width;
            height: 100%;
            background: $content-background-color;

            .followups-title,
            .artifact-links-title {
                font-size: 1em;
                text-transform: uppercase;
            }
        }

        .tuleap-modal-side-panel-grip {
            *display: none;
            float: right;
            background: $grip-background-color;
            height: 100%;
            width: $grip-width;
            position: relative;
            cursor: pointer;
            border-top-right-radius: $modal-radius;
            border-bottom-right-radius: $modal-radius;
            font-size: 0.80em;
            line-height: 1.2em;
            font-weight: bold;
            color: darken($grip-background-color, 50%);
            text-shadow: 0 1px 0 lighten($grip-background-color, 10%);
            text-transform: uppercase;

            span {
                background-color: $grip-background-color;
                color: $grip-color;
                letter-spacing: 0.1em;
                font-weight: normal;
                line-height: 1.5em;
                display: block;
                text-align: center;
                bottom: 0;
                height: $grip-width / 2;
                position: absolute;
                left: $grip-width / 4;
                top: -$grip-width / 2;
                -webkit-transform: rotate(90deg);
                -webkit-transform-origin: bottom left;
                -moz-transform: rotate(90deg);
                -moz-transform-origin: bottom left;
                -ms-transform: rotate(90deg);
                -ms-transform-origin: bottom left;
                -o-transform: rotate(90deg);
                -o-transform-origin: bottom left;
            }
        }

        &:first-child {
            .tuleap-modal-side-panel-grip {
                float: left;
                border-top-right-radius: 0;
                border-bottom-right-radius: 0;
                border-top-left-radius: $modal-radius;
                border-bottom-left-radius: $modal-radius;

                span {
                    top: auto;
                    left: $grip-width / 2 + $grip-width / 4;
                    -webkit-transform: rotate(-90deg);
                    -webkit-transform-origin: bottom left;
                    -moz-transform: rotate(-90deg);
                    -moz-transform-origin: bottom left;
                    -ms-transform: rotate(-90deg);
                    -ms-transform-origin: bottom left;
                    -o-transform: rotate(-90deg);
                    -o-transform-origin: bottom left;
                    *left: $grip-width / 4;
                    *width: $modal-height;
                }
            }
        }
    }

    .tuleap-modal-main-panel {
        float: left;
        width: $modal-width;
    }

    .tuleap-modal-title, .tuleap-modal-side-panel-content-title {
        background-color: $title-background-color;
        color: $title-color;
        border-bottom: 1px solid darken($title-background-color, 10%);
        padding: 7px $modal-padding;

        h3 {
            padding: 0 5px 0 0;
            margin: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        i {
            float: right;
            font-size: 1.3em;
            color: #CCC;
            margin-top: 11px;
            cursor: pointer;

            &:hover {
                color: #888;
            }
        }
    }
    .tuleap-modal-title {
        border-top-left-radius: $modal-radius;
        border-top-right-radius: $modal-radius;
    }
    &.tuleap-modal-pimped .tuleap-modal-title {
        border-radius: 0;
    }

    .tuleap-modal-content, .tuleap-modal-side-panel-content-content {
        background: $content-background-color;
        padding: 0;
        height: $modal-height;
        overflow-y: auto;
    }
    .tuleap-modal-side-panel-content-content {
        background: $side-content-background-color;
    }

    .tuleap-modal-actions, .tuleap-modal-side-panel-content-actions {
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        background-color: $action-background-color;
        border-top: 1px solid lighten($action-background-color, 10%);
        box-shadow: 0 -1px 0 darken($action-background-color, 10%);
        padding: $modal-padding;
        text-align: right;
        min-height: 61px;
    }
    .tuleap-modal-side-panel-content-actions {
        background-color: $side-action-background-color;
    }
    .tuleap-modal-actions {
        border-bottom-left-radius: $modal-radius;
        border-bottom-right-radius: $modal-radius;
    }
    &.tuleap-modal-pimped .tuleap-modal-actions {
        border-radius: 0;
    }
}
